package com.kang.es.dao;

import com.kang.es.pojo.Item;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

import java.util.List;

public interface ItemRepository extends ElasticsearchRepository<Item, Integer> {

    /**
     * 根据Title和Content查询，交集
     *
     * @param title
     * @param content
     * @return
     */
    List<Item> findByTitleAndContent(String title, String content);

    /**
     * 根据Title或Content分页查询，并集
     */
    Page<Item> findByTitleOrContent(String title, String content, PageRequest of);

    /**
     * 根据title和Content和id范围分页查询
     *
     */
    Page<Item> findByTitleAndContentAndIdBetween(String title, String content, Long min, Long max, PageRequest of);
}
